<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<?php
    include_once('db.php');
    $id_pago=$_POST['no_folio_b'];

    $result = mysql_query("SELECT * from corte order by id_corte desc limit 1");
    while ($row = mysql_fetch_array($result)) {
        $numero_de_corte = $row['id_corte'];
    }


    $corte = '';
    $fecha = '';
    $empresa = '';
    $total = '';

    $sql = "select a.id_pago, a.id_corte, a.fecha, b.nombre, a.monto from pago a join empresa b on a.id_empresa = b.id_empresa  where a.id_pago = $id_pago";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_array($result)) {
        $corte = $row['id_corte'];
        $fecha = $row['fecha'];
        $empresa = $row['nombre'];
        $total = $row['monto'];
    }


?>


<html >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Saade: Captura de facturas de clientes</title>
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <link rel="stylesheet" type="text/css" href="css/form.css" />  
        <link rel="stylesheet" href="css/example.css" TYPE="text/css" MEDIA="screen">
        <script type="text/javascript" src="js/bsn.AutoSuggest_c_2.0.js"></script>
        <script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
        <script type="text/javascript" src="js/tabber.js"></script>
        <script type="text/javascript">

            /* Optional: Temporarily hide the "tabber" class so it does not "flash"
            on the page as plain HTML. After tabber runs, the class is changed
            to "tabberlive" and it will appear. */

            document.write('<style type="text/css">.tabber{display:none;}<\/style>');
        </script>
        <script>
            function cerrar()
            {
                parent.$.fancybox.close();
            }
        </script>
        <script>
            function cerrar()
            {
                parent.$.fancybox.close();
            }

            function validar(){
                if (confirm("Seguro que quiere eliminar el pago?")) {
                    // Respuesta afirmativa...
                    return true;
                }else{
                    return false;
                }   
            }
        </script>
        <script type="text/javascript" src="js/jquery.tools.min.js"></script>

    </head>
    <body style="margin: 0px; padding: 0px;" >
        <div class="header_fancy">
            <div class="cerrar_fancy" onclick="cerrar();"></div> 
            <p style="margin-left: 23px; padding-top: 20px; margin-top:0px">EDITAR PAGO.</p>

        </div>
        <br><br>
        <table id="forma" align="center">
            <?php if ($numero_de_corte == $corte) {?>
                <tr>
                    <td>       
                        <div id="forma_ingredientes">
                            <form action="editar_pago_procesa.php" enctype="multipart/form-data" method="POST" name="ingrediente" id="ingrediente" onsubmit="return validar(this.form);">
                                <table align="center">
                                    <tr>
                                        <td align="right" style="padding-right: 15px;"><div class="input_fancy2">Id:</div></td>
                                        <td ><input type="text" autocomplete="off"  readonly style="background-color:#ccc;" class="idle_fancy" align="LEFT" size="20" value="<?php echo $id_pago ?>" name="id_pago"  required="required" /></td>
                                    </tr>
                                    <tr>
                                        <td align="right" style="padding-right: 15px;"><div class="input_fancy2">Corte:</div></td>
                                        <td >
                                            <input type="text" autocomplete="off"  readonly style="background-color:#ccc;" class="idle_fancy" align="LEFT" size="20" value="<?php echo $corte ?>" name="corte"  required="required" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" style="padding-right: 15px;"><div class="input_fancy2">Fecha:</div></td>
                                        <td ><input type="text" autocomplete="off" readonly class="idle_fancy" align="LEFT" size="20" name="fecha" value="<?php echo $fecha ?>" required="required" /></td>
                                    </tr>
                                    <tr>
                                        <td align="right" style="padding-right: 15px;"><div class="input_fancy2">Empresa:</div></td>
                                        <td ><input type="text" autocomplete="off" readonly class="idle_fancy" align="LEFT" size="20" name="empresa" value="<?php echo $empresa ?>"  required="required" /></td>
                                    </tr>
                                    <tr>
                                        <td align="right" style="padding-right: 15px;"><div class="input_fancy2">Monto:</div></td>
                                        <td ><input type="text" autocomplete="off" readonly class="idle_fancy" align="LEFT" size="20" name="total" value="<?php echo $total ?>"  required="required" />
                                           <td align="right"><span style="margin-left: 110px;"></span><input type="image" src="img/todo/BOTON_ELIMINAR.png" >
                                        </td>

                                    </tr>
                                    <tr>
                                    <td></td> </td>
                                    </tr>

                                </table>
                                     
                            </form>
                            <br>
                        </div> 

                    </td>
                </tr>
                <?php }else{?>
                <tr>
                    <center><span class="input_fancy2">EL PAGO YA FUE CONTABILIZADO EN UN CORTE.</span> </center>  
                </tr>
                <?php } ?>
        </table>
        <script>
            $("#ingrediente").validator();
        </script>
    </body>
</html>